package com.mcgrady.collection;

import org.junit.Test;

/**
 * @author McGrady
 */
public class PointTest {
    static class Point<T> {
        private T x;
        private T y;

        public T getX() {
            return x;
        }

        public void setX(T x) {
            this.x = x;
        }

        public T getY() {
            return y;
        }

        public void setY(T y) {
            this.y = y;
        }
    }

    @Test
    public void point() {
        Point<Integer> pointA = new Point<>();
        pointA.setX(10);
        pointA.setY(20);
        System.out.println(pointA.getX() + " : " + pointA.getY());

        Point<Double> pointB = new Point<>();
        pointB.setX(10.5);
        pointB.setY(20.5);
        System.out.println(pointB.getX() + " : " + pointB.getY());

        Point<String> pointC = new Point<>();
        pointC.setX("东经42");
        pointC.setY("北纬52");
        System.out.println(pointC.getX() + " : " + pointC.getY());

        Point pointD = new Point();
        pointD.setX(10);
        pointD.setY("北纬52");
        System.out.println(pointD.getX() + " : " + pointD.getY());
    }
}
